package com.wbk.lotterysystemlotteryservice.commons.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@ApiModel
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LotteryBO implements Serializable {

    @ApiModelProperty(value = "商家用户编号", required = true)
    private Long storeUserNo;

    @ApiModelProperty(value = "开始时间", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @FutureOrPresent(message = "开始时间需要是一个将来或现在的时间")
    private Date startTime;

    @ApiModelProperty(value = "截止时间", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Future(message = "截止时间需要是一个将来的时间")
    private Date dueTime;

    @ApiModelProperty(value = "抽奖标题", required = true)
    @NotBlank(message = "抽奖标题不能为空")
    private String lotteryTitle;

    @ApiModelProperty(value = "抽奖介绍", required = true)
    @NotBlank(message = "抽奖介绍不能为空")
    private String lotteryExplain;

    @ApiModelProperty(value = "最低参与人数", required = true)
    @Min(value = 1, message = "最低参与人数必须大于等于1")
    private Integer minimumPerson;

    @ApiModelProperty(value = "奖品", required = true)
    @Valid
    @NotEmpty(message = "奖品不能为空")
    private List<PrizeBO> prizeBOList;
}
